// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import store from './store'

import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import '@/styles/index.scss' // global css

import './common/routerIntercepter'
import global from './common/Global'
import './assets/iconfont/iconfont.css'
import {hasPermission} from './utils/auth'

Vue.use(ElementUI, {size: 'small'})

Vue.config.productionTip = false

Vue.prototype.GLOBAL = global; // 全局常量

/**
 * 自定义按钮权限判断指令
 */
Vue.directive('has', {
  bind (el, binding, vnode) {
    if (!hasPermission(binding.value)) {
      el.parentNode.removeChild(el);
    }
  }
})

/* eslint-disable no-new */
new Vue({
  el: '#app',
  store,
  router,
  render: h => h(App)
})
